<?php include template("html_header");?>

<?php if($session_notice=Session::Get('notice',true)){?>
<div class="sysmsgw" id="sysmsg-success"><div class="sysmsg"><p><?php echo $session_notice; ?></p><span class="close">关闭</span></div></div> 
<?php }?>
<?php if($session_notice=Session::Get('error',true)){?>
<div class="sysmsgw" id="sysmsg-error"><div class="sysmsg"><p><?php echo $session_notice; ?></p><span class="close">关闭</span></div></div> 
<?php }?>

		<div class="reg_wrap">
			<!-- 顶部 LOGO -->
			<div class="TopName">
				<div class="logo">
				</div>
				<a href="" target="_blank" class="logoLink">
				</a>
				<div class="op" id="login_info">
					<?php if($login_user){?>
					<span>
						欢迎您，
						<a href="/order/index.php">
							<?php echo $login_user['username']; ?>
						</a>
						！
					</span>
					<span class="line">
						|
					</span>
					<span>
						<a href="/account/ajax/logout.php">退出</a>
					</span>
					<?php } else { ?>
					<span>
						分享宝贝，拿优惠
						<a href="/account/ajax/login.php" class="ajaxlink">
							登录
						</a>
					</span>
					<span class="line">
						|
					</span>
					<span>
						<a href="/account/signup.php" target="_blank">
							注册
						</a>
					</span>
					<?php }?>
				</div>
			</div>
			<!-- /顶部 LOGO -->
			<div class="reg_main">				
				<form id="connect-share-form" action="" method="post" class="validator">
					<b class="bg_regTop">
						&nbsp;
					</b>
					<b class="bg_deco_b">
						&nbsp;
					</b>
					<div class="reg_pub">
						<div class="notice">
							<h2>
								<img src="/static/css/share/transparent.gif" class="wbIcon iconMsg" alt="" title="">
								这个宝贝为什么吸引你？
							</h2>
							<span id="txt_count_msg">
								还可以输入
								<em id="txt_input_num">
									120
								</em>
								字
							</span>
						</div>
						<div class="inputTxt">
							<textarea cols="20" rows="5" id="write_content" name="write_content" onMouseMove="javascript:checkInputNum();" onKeyUp="javascript:checkInputNum();"></textarea>
							<dl>
								<dt>
								将发布的消息如下
								</dt>
							</dl>
							<textarea cols="20" rows="5" id="remark" name="remark" readonly="readonly"></textarea>
						</div>
						<div class="submit">
							<p id="repeatTip">
								<?php if(!$login_user){?>
									可以同步到：
									<img src="/static/sync/logo_renren.png" title="人人网" />
									<img src="/static/sync/logo_sina.png" title="新浪微博" />
								<?php } else if((count($user_network_weights) == 1) && ($user_network_weights['total'] == 0)) { ?>
									请设置同步：
									<?php if(!array_key_exists('renren', $user_network_weights)){?>
									<a href="/account/ajax/sync_settings.php?web=renren" class="ajaxlink"><img src="/static/sync/logo_renren.png" title="人人网" /></a>
									<?php }?>
									<?php if(!array_key_exists('sina', $user_network_weights)){?>
									<a href="/account/ajax/sync_settings.php?web=sina&action=make_auth_url" class="ajaxlink"><img src="/static/sync/logo_sina.png" title="新浪微博" /></a>
									<?php }?>
								<?php } else { ?>
									已经同步到：
									<?php if(is_array($user_network_weights)){foreach($user_network_weights AS $index=>$one) { ?>
										<?php if($index == 'renren'){?>
											<img src="/static/sync/logo_renren.png" title="人人网" />
										<?php } else if($index == 'sina') { ?>
											<img src="/static/sync/logo_sina.png" title="新浪微博" />
										<?php }?>
									<?php }}?>
									<br/>
									<?php if(count($user_network_weights) < 3){?>
										还可以同步到：
										<?php if(!array_key_exists('renren', $user_network_weights)){?>
										<a href="/account/ajax/sync_settings.php?web=renren" class="ajaxlink"><img src="/static/sync/logo_renren.png" title="人人网" /></a>
										<?php }?>
										<?php if(!array_key_exists('sina', $user_network_weights)){?>
										<a href="/account/ajax/sync_settings.php?web=sina&action=make_auth_url" class="ajaxlink"><img src="/static/sync/logo_sina.png" title="新浪微博" /></a>
										<?php }?>
									<?php }?>
								<?php }?>
							</p>
							<span class="btn_turn">
								<span style="display:<?php echo $login_user?'block':'none'; ?>;">
								手机号码：<input type="text" size="25" id="mobile" name="mobile" id="signup-mobile" class="number" value="<?php echo $login_user['mobile']; ?>" require="true" datatype="mobile" onMouseMove="javascript:checkInputNum();" onKeyUp="javascript:checkInputNum();"/>
								<br/><span style="font-size: 12px;color: #989898;">（用于接收电子代金券）</span><br/>
								</span>								
								<a id="publish_btn" class="MIB_bigBtn MIB_bigBtnB ajaxlink" href="/account/ajax/login.php"><cite>分享消息，获取代金券</cite></a>
							</span>
						</div>
					</div>
				</form>
				<b class="bg_regBot">
					&nbsp;
				</b>
			</div>
			<!--气泡层-->
			<!--/气泡层-->
			<div style="padding: 3px 10px;">
				<a href="/feedback/seller.php" target="_blank">
					获取影响力支付按钮
				</a>
			</div>
		</div>
		
		<script type="text/javascript">
			function getQuery(name) {
				var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
				var r = window.location.search.substr(1).match(reg);
				return r != null ? r[2] : ""
			}
			function checkInputNum(){
				var maxInputNum = 120;
				var tmpInputNum = document.getElementById("write_content").value.length;
				if(tmpInputNum > maxInputNum){
					document.getElementById("write_content").value = document.getElementById("write_content").value.substring(0, maxInputNum);
				} else{
					document.getElementById("txt_input_num").innerHTML = maxInputNum - tmpInputNum;
				}
				document.getElementById("remark").value = document.getElementById("write_content").value + " " + decodeURIComponent(getQuery("url"));
				document.getElementById("publish_btn").href = "http://test.com/free/account/ajax/login.php" + "?appkey="+ encodeURIComponent(getQuery("appkey")) + "&remark=" + encodeURIComponent(document.getElementById("remark").value) + "&mobile=" + encodeURIComponent(document.getElementById("mobile").value);
			}
			(function(){
				document.getElementById("remark").value = decodeURIComponent(getQuery("url"));
			})()
		</script>
<?php include template("html_footer");?>